Skip to content

Conversation

@eemeli
Copy link
Owner

@eemeli eemeli commented Feb 7, 2026

This PR includes a bunch of breaking changes for v3.

The general thrust here is ensure/enforce that values within a Document are wrapped in Node values, and to remove the custom instance checks. By only releasing the package as an ESM module, we avoid any dual package hazard, and so can simply rely on native isinstance checks.

With the changes here, when a value is added using e.g. doc.add() or .addIn(), the values are automatically wrapped/represented using appropriate Node instances. Node creation is also refactored, but that should be an implementation detail.

The root value of a document is now available as its .value (previously .contents), and it is no longer allowed to be null, but must instead be a Node. Similarly, all mapping keys (i.e. pair.key values) must be Nodes, and cannot be null. Mapping values (pair.value) can still be null, or a Node value.

Internally, the Node-ness of Document values is no longer checked, but is assumed. So assigning non-Node values to doc.value or to collection .items is likely to cause misbehaviour.

@eemeli eemeli added this to the v3 milestone Feb 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant